"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".

Replace these with more appropriate tests for your application.
"""

from django.test import TestCase

from ftbexplorer.core.models import WordTreeNode, Sentence, XMLFile

from clauses import EmptyClause, WordClause, Clause
from templatetags.connecteurs import clauses

def phony_word(form, lemma, cat):
    return WordTreeNode(form=form, lemma=lemma, cat=cat)

def phony_sentence():
    return Sentence
class SimpleTest(TestCase):
    def test_basic_addition(self):
        """
        Tests that 1 + 1 always equals 2.
        """
        self.failUnlessEqual(1 + 1, 2)
        
class ClauseTest(TestCase):
    def test_clause_iterator(self):
        cl = EmptyClause()
        assert list(cl) == []
        wcl1 = WordClause(phony_word("maison", "maison", "N"))
        cl += wcl1
        assert list(cl) == [wcl1]
        cl = Clause(cl)
        assert list(cl) == [wcl1]
    

class TeplatetagsTest(TestCase):
    def test_clauses(self):
        sent = Sentence.objects.get(file=XMLFile.objects.get(name="flmf7aa1ep.cat.xml"), nb="501")
        clauses(sent)
        

# class TestConnecteurs(TestCase):
#     def test_est_connecteur(self):
#         word = object()
#         word.form = "avant que"
#         word.lemma = "avant que"
#         word.cat = "C"
#         assert est_connecteur(word)

__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.

>>> 1 + 1 == 2
True
"""}

